package com.kaifamiao.N0824;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Node1 {

    public static void main(String[] args) {

        Calendar calendar = Calendar.getInstance();

        System.out.println(calendar.toInstant().toString());

       // calendar.add(Calendar.MONTH);
       // calendar.clear(Calendar.YEAR);
       // calendar.set(Calendar.HOUR_OF_DAY);
       // System.out.println(calendar.toInstant().toString());

        System.out.println("年份是"+calendar.get(Calendar.YEAR));
        System.out.println("月份是"+calendar.get(Calendar.MONTH));
        System.out.println(calendar.get(Calendar.HOUR_OF_DAY));
        System.out.println("小时是"+calendar.get(Calendar.HOUR));

        calendar.set(Calendar.YEAR,2001);
        calendar.set(Calendar.MONTH,0);
        calendar.set(Calendar.DAY_OF_MONTH,10);

        Date date =calendar.getTime();
        DateFormat dateFormat1 =DateFormat.getDateInstance();
        System.out.println("我的生日是："+ dateFormat1.format(date));
        DateFormat dateFormat =new SimpleDateFormat("yyyy年 MM月 dd日 HH小时 mm分钟 " );
        System.out.println(dateFormat.format(date));

    }

}
